<?php
error_reporting(E_ALL ^ E_NOTICE);
require_once('config.php');
$id_customer = $_POST['id_customer'];

$return_arr = array();

if(!empty($id_customer)){
	$fetch = mysql_query("SELECT * FROM tb_customer a
LEFT JOIN tb_schedule b ON
a.id_customer=b.id_customer WHERE a.id_customer = '" . mysql_real_escape_string($id_customer) . "' ORDER BY tgl_jual DESC"); 
		$ono = mysql_num_rows($fetch);
		/* Retrieve and store in array the results of the query.*/
		while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
			$row_array['id_customer'] = $row['id_customer'];
			$row_array['kunjungan'] = $row['tgl_jual'];
			$row_array['remainder'] = $row['remainder'];				
	        array_push($return_arr,$row_array);
	    }
}

echo json_encode($return_arr);
?>